package cn.job.j1

import scala.annotation.tailrec

object Case1 {

  @tailrec
  def getNumber(cap: Int, empty: Int, count: Int): Int = {
    if (cap < 5 && empty < 3) {
      return count
    }
    val c1 = cap / 5
    val c2 = cap % 5

    val e1 = empty / 3
    val e2 = empty % 3
    println(s"cap = ${c1 + e1 + e2},empty =${c1 + e1 + c2}, total = ${count + c1 + e1}")
    getNumber(c1 + e1 + c2, c1 + e1 + e2, count + c1 + e1)
  }

  def main(args: Array[String]): Unit = {
    val cap = 100 / 2
    val empty = 100 / 2
    val result = getNumber(cap, empty, empty)
    println(s"一共可以喝${result}瓶酒")
  }
}
